import Vue from 'vue'
import Vuex from 'vuex'
import { getStorage, setStorage, removeStorage } from '@/utils/storage'
import favorite from './modules/favorite.js'
import details from './modules/details.js'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: getStorage('tts'),
    cityname: getStorage('hkzf_city')
  },
  mutations: {
    inituser (state, data) {
      state.user = data
      setStorage('tts', data)
    },
    removeuser (state) {
      state.user = null
      removeStorage('tts')
    }
  },
  actions: {
  },
  modules: {
    favorite,
    details
  }
})
